<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:Apex.Controls"
    xmlns:converters="clr-namespace:Apex.Converters"
    xmlns:dragAndDrop="clr-namespace:Apex.DragAndDrop">

    <Style TargetType="{x:Type controls:ImageCheckBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:ImageCheckBox}">
                    <ControlTemplate.Resources>
                        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
                    </ControlTemplate.Resources>
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>

                            <Image 
                                Source="{TemplateBinding CheckedImageSource}" Stretch="None" RenderOptions.BitmapScalingMode="Linear" 
                                Margin="{TemplateBinding Padding}"
                                Visibility="{TemplateBinding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}"
                                />

                            <Image 
                                Source="{TemplateBinding UncheckedImageSource}" Stretch="None" RenderOptions.BitmapScalingMode="Linear" 
                                Margin="{TemplateBinding Padding}"
                                Visibility="{TemplateBinding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Invert}"
                                />

                        </Grid>                        
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
